#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file './translatedialogbase.ui'
**
** Created: 二  8月 28 16:49:55 2007
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.7   edited Aug 31 2005 $)
**斗争的生活使你干练，苦闷的煎熬使你醇化；这是时代要造成青年为能担负历史使命的两件法宝。 —— 茅盾
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "translatedialogbase.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qcheckbox.h>

#include <kcombobox.h>

/*
 *  Constructs a TranslateDialogBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
TranslateDialogBase::TranslateDialogBase( QWidget* parent, const char* name)
    : QDialog( parent, name)
{
    if ( !name )
    setName( "TranslateDialogBase" );
    setSizeGripEnabled( TRUE );
    TranslateDialogBaseLayout = new QVBoxLayout( this, 11, 6, "TranslateDialogBaseLayout"); 

    layout4 = new QHBoxLayout( 0, 0, 6, "layout4"); 

    textLabel1 = new QLabel( this, "textLabel1" );
    textLabel1->setTextFormat( QLabel::AutoText );
    layout4->addWidget( textLabel1 );

    histText = new KHistoryCombo( this, "histText" );
    histText->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, histText->sizePolicy().hasHeightForWidth() ) );
    histText->setDuplicatesEnabled( FALSE );
    histText->setAutoCompletion(true);//开起自动补全功能
    histText->setMaxCount(15);//设置历史记录的最大条目数
    layout4->addWidget( histText );

    buttonTranslate = new QPushButton( this, "buttonTranslate" );
    buttonTranslate->setDefault( TRUE );
    layout4->addWidget( buttonTranslate );

    checkBox1 = new QCheckBox( this, "checkBox1" );
    layout4->addWidget( checkBox1 );
    TranslateDialogBaseLayout->addLayout( layout4 );
    languageChange();
    resize( QSize(604, 441).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections\

    connect(histText, SIGNAL(activated(const QString& )), histText, SLOT(addToHistory(const QString& )));//把字符自动添加到当前历史记录里
    connect( buttonTranslate, SIGNAL( clicked() ), this, SLOT( translateClicked() ) );
    connect( histText, SIGNAL( textChanged(const QString&) ), this, SLOT( textChanged(const QString&) ) );
    connect( checkBox1, SIGNAL( toggled ( bool  ) ), this, SLOT( fetchWordClicked(bool ) ) );
    // buddies
    textLabel1->setBuddy( histText );
}

/*
 *  Destroys the object and frees any allocated resources
 */
TranslateDialogBase::~TranslateDialogBase()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void TranslateDialogBase::languageChange()
{
    setCaption( tr2i18n( "Translate" ) );
    textLabel1->setText( tr2i18n( "&Search word:" ) );
    QWhatsThis::add( textLabel1, tr2i18n( "Enter the word or phrase you want to translate" ) );
    buttonTranslate->setText( tr2i18n( "Tra&nslate" ) );
    buttonTranslate->setAccel( QKeySequence( tr2i18n( "Alt+N" ) ) );
    checkBox1->setText( tr2i18n( "&Fetch word" ) );
    checkBox1->setAccel( QKeySequence( tr2i18n( "Alt+F" ) ) );
}

void TranslateDialogBase::translateClicked()
{
    qWarning( "TranslateDialogBase::translateClicked(): Not implemented yet" );
}

void TranslateDialogBase::fetchResults()
{
    qWarning( "TranslateDialogBase::fetchResults(): Not implemented yet" );
}

void TranslateDialogBase::textChanged(const QString&)
{
    qWarning( "TranslateDialogBase::textChanged(const QString&): Not implemented yet" );
}

void TranslateDialogBase::fetchWordClicked(bool )
{
   qWarning( "TranslateDialogBase::fetchWordClicked(): Not implemented yet" );
}
#include "translatedialogbase.moc"
